package com.epalmpay.controller.ys.oilcard;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.epalmpay.commom.BaseController;
import com.epalmpay.exception.ApplicationException;
import com.epalmpay.status.Rescode;
import com.epalmpay.dto.oilcard.OilcardMemberInDTO;
import com.epalmpay.dto.oilcard.OilcardMemberListOutDTO;
import com.epalmpay.dto.system.PageDTO;
import com.epalmpay.entity.Page;
import com.epalmpay.service.yunstream.IOilCardService;
import com.epalmpay.util.Tools;

@Controller
@RequestMapping(value="/merchant/oilcardmember")
public class OilcardMemberController extends BaseController{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Resource
	private IOilCardService oilCardService;

	/**
	 * 显示用户油卡列表
	 * @param oilcardMemberInDTO
	 * @param pageDTO
	 * @return
	 */
	@RequestMapping(value="/list")
	@ResponseBody
	public OilcardMemberListOutDTO  oilacrdMemberList(OilcardMemberInDTO oilcardMemberInDTO,PageDTO pageDTO){
		OilcardMemberListOutDTO oilcardMemberListOutDTO=new OilcardMemberListOutDTO();
		try {
			Page page=Tools.pageEmtity(pageDTO);
			
			oilcardMemberListOutDTO = oilCardService.getOilcardMemberList(oilcardMemberInDTO,page);			
			oilcardMemberListOutDTO.setPage(page); 
			oilcardMemberListOutDTO.setErrorCode(Rescode.SUCCESS, "处理成功");
			
			return oilcardMemberListOutDTO;
		} catch (ApplicationException ae) { 
			oilcardMemberListOutDTO.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
		}
		 catch (Exception e) { 
			 oilcardMemberListOutDTO.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
		}
		return oilcardMemberListOutDTO;
	}		
	
	
}
